﻿using Beaker;
using Beaker.Specs;
using OpenCube.Model.Primitives;

namespace OpenCube.Model.Specs.Builders
{
	public sealed class GameTimeSpanBuilder
		: Builder<GameTimeSpan>
	{
		private Maybe<long> _gameTicks;

		public GameTimeSpanBuilder WithTicks(long ticks)
		{
			_gameTicks = ticks;
			return this;
		}

		public override GameTimeSpan Build()
		{
			if (_gameTicks.HasValue)
				return new GameTimeSpan(_gameTicks.Value);

			return new GameTimeSpan();
		}
	}
}